'use strict';

module.exports = app => {
  const mongoose = app.mongoose;
  const Schema = mongoose.Schema;

  const HomesSchema = new Schema({
    username: String,
  });

  HomesSchema.pre('save', function(next) {
    this.ids = `${this.test}_${this.test.substring(5)}`;
    next();
  });
  return mongoose.model('homes', HomesSchema, null, { cache: false });
};
